package cate.common.table.mall.row;

import cate.common.table.EExcelNoteField;
import cate.common.table.EExcelRowClass;
import cate.common.table.ERow;
import cate.common.util.random.RWItem;
import org.apache.commons.lang3.StringUtils;

@EExcelRowClass(IDTitle = "id")
public class TreasureHouseItemRow extends ERow implements RWItem {
    @EExcelNoteField(fieldName = "商品id")
    public int itemId;

    @EExcelNoteField(fieldName = "主角等级下限")
    public int levelMin;

    @EExcelNoteField(fieldName = "主角等级上限")
    public int levelMax;

    @EExcelNoteField(fieldName = "开服天数下限")
    public int opendayMin;

    @EExcelNoteField(fieldName = "开服天数上限")
    public int opendayMax;

    @EExcelNoteField(fieldName = "权重")
    public double weight;

    @EExcelNoteField(fieldName = "进阶材料条件")
    private String conditionStr;

    public int equipPos = -1;

    public int equipGrade = -1;

    @Override
    public void decode() {
        if (StringUtils.isNotBlank(conditionStr)) {
            String[] split = conditionStr.split("#");
            equipPos = Integer.parseInt(split[0]);
            equipGrade = Integer.parseInt(split[1]);
        }
    }

    @Override
    public double getWeight() {
        return weight;
    }
}
